package com.springboot.astra.service.serviceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.astra.bean.Comment;
import com.springboot.astra.mapper.CommentMapper;
import com.springboot.astra.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    CommentMapper commentMapper;

    @Override
    public Comment getOneCommentById(Integer id) throws Exception {
        return commentMapper.getOneCommentById(id);
    }

    @Override
    public IPage<Comment> getAllComment(Page<Comment> page, String query) throws Exception {
        return commentMapper.getAllComment(page,query);
    }

    @Override
    public IPage<Comment> getAllCommentByUserId(Page<Comment> page, String query) throws Exception {
        return commentMapper.getAllCommentByUserId(page,query);
    }

    @Override
    public void insertCommentForOneGoods(Comment comment) throws Exception {
        commentMapper.insertCommentForOneGoods(comment);
    }

    @Override
    public void updateCommentForOneGoods(Comment comment) throws Exception {
        commentMapper.updateCommentForOneGoods(comment);
    }

    @Override
    public void deleteCommentForOneGoods(Comment comment) throws Exception {
        commentMapper.deleteCommentForOneGoods(comment);
    }
}
